stages:
    - build
    - upload
    - deploy

build-be:
    stage: build
    script:
        - docker build -t backend:$CI_COMMIT_SHORT_SHA ./shop-backend

build-fe:
    stage: build
    script:
        - docker build -t frontend:$CI_COMMIT_SHORT_SHA ./shop-frontend

upload-be:
    stage: upload
    needs:
        - job: build-be
    script:
        - kind load docker-image backend:$CI_COMMIT_SHORT_SHA

upload-fe:
    stage: upload
    needs:
        - job: build-fe
    script:
        - kind load docker-image frontend:$CI_COMMIT_SHORT_SHA

deploy:
    stage: deploy
    needs:
        - job: upload-be
        - job: upload-fe
    environment:
        name: production
    script:
        - kubectl get pods -o wide
